<%-- 
    Document   : results
    Created on : Mar 22, 2013, 4:31:01 AM
    Author     : shou1dwe
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList, com.esdc.librarysystem.datastate.BookLoanState, com.esdc.librarysystem.datastate.ReservationState"%>
<%@include file="utility.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <style>
            p.formheader {padding-left:20px;}

            span {display: inline-block;min-width:100px;}
<%--span.reservationtitle {display: inline-block;width:100px;}
span.reservationdate {display: inline-block;width:250px;}--%>
        </style>
    </head>
    <body>
        <h1>Results:</h1>

        <form action="Status" method="POST">
            <p class="formheader">
                <span class="resultid">ID</span>
                <span class="resulttitle">TITLE</span>
                <span class="resultcopies"># of Copies</span>
                <span class="resultauthor">Author</span>
                <span class="resultpublisher">Publisher</span>
                <span class="resultdue">Due Date</span>
            </p>
            <%
                ArrayList<BookLoanState> loans = (ArrayList<BookLoanState>) request.getAttribute("results");
                for (BookLoanState book : loans) {
            %>
            <p><input type="checkbox" name="result" value="<%=book.getId()%>" />
                <span class="resultid"><%=book.getId()%></span>
                <span class="resulttitle"><%=book.getTitle()%></span>
                <span class="resultcopies"><%=book.getCopyNumber()%></span>
                <span class="resultauthor"><%=book.getAuthor()%></span>
                <span class="resultpublisher"><%=book.getPublisher()%></span>
                <span class="resultdue"><%=book.getDueDate() == null? "Available":formatDate(book.getDueDate())%></span>
            </p>
            <%
                }
            %>
            <input type="submit" value="Reserve">
        </form>

            <a href="Status">Back</a>
    </body>
</html>
